Arm platforms: Fix DRAM address macros
authorSandrine Bailleux <[email protected]>
Wed, 31 Oct 2018 13:28:17 +0000 (14:28 +0100)
committerSandrine Bailleux <[email protected]>
Wed, 7 Nov 2018 10:34:28 +0000 (11:34 +0100)
On AArch32, ARM_DRAM1_BASE and ARM_DRAM1_SIZE constants are currently
32-bit values (because they are suffixed with UL and the value
0x80000000 fits in a unsigned long int, i.e. a 32-bit value). When
summing them up, the result overflows the maximum value that can be
encoded in a 32-bit value so it wraps around and does not result in
the expected value.

This patch changes the suffix of these constants into ULL so that they
always are 64-bit values.

Change-Id: I3b19b1805e35cc7e43050458df379081b1e882d5
Signed-off-by: Sandrine Bailleux <[email protected]>
include/plat/arm/common/arm_def.h

index 088d59dca99f0d1377b1e09c5070db8dce9210b5..d02a4059a97d26cac0bb50b9a566fa49001ef169 100644 (file)
 #define ARM_NS_DRAM1_END               (ARM_NS_DRAM1_BASE +            \
                                         ARM_NS_DRAM1_SIZE - 1)
 
-#define ARM_DRAM1_BASE                 UL(0x80000000)
-#define ARM_DRAM1_SIZE                 UL(0x80000000)
+#define ARM_DRAM1_BASE                 ULL(0x80000000)
+#define ARM_DRAM1_SIZE                 ULL(0x80000000)
 #define ARM_DRAM1_END                  (ARM_DRAM1_BASE +               \
                                         ARM_DRAM1_SIZE - 1)